**********************************
*******SCATTERPLOTS***************
**********************************


clear all
set matsize 800
set more off


use "${datapath}/fascism_db.dta", clear

**********************************
*****
local demo "lpop1911 lpop2 lpop3 lpop4 sh_pop_1911_be6"
local cntls_spec1 "lpop1911 lpop2 lpop3 lpop4 sh_pop_1911_be6 d_reg* province*"
local cntls_spec2 "`cntls_spec1' larea centre_alt max_alt"
local cntls_spec3 "`cntls_spec2' psu1913_vv"
local cntls_spec4 "`cntls_spec3' veterans74_95 veterans96_00 ard_vol_pop6m cruent_d army_suppliers_d"
local cntls_spec5 "`cntls_spec4' dlab shcrop landlord_ass"
local cntls_spec6 "`cntls_spec5' ind_workers ind_firms literacy elites bourgeoisie"

***************
***FIG 4*******
***************

*psu1919_vv predicted
qui reg psu1919_vv foots_pop6m `cntls_spec6'
predict hat_psu1919_vv, xb
*psu1919_vv predicted residuals
qui reg hat_psu1919_vv `cntls_spec6'
predict res_hpsu1919_vv, residuals
***
*fascist_violence residuals
qui reg fascist_violence `cntls_spec6'
predict res_fascist_violence, residuals
*fascist_violence_pop20_22 scatter
binscatter res_fascist_violence res_hpsu1919_vv, nquantiles(44) yti(Fascist violence 1920-2, size(medium)) xti(Socialist vote share 1919, size(medium)) xlab(-0.02(0.02)0.04, nogrid labsize(medium)) ylab(-0.05(0.05)0.05, nogrid labsize(medium)) xscale(lcolor("black") fextend) yscale(lcolor("black") fextend ) plotregion(color(white))
graph export "${outpath}/fig4a.png", width(4000) replace
***
*fasci_branch residuals
qui reg fascist_branch `cntls_spec6'
predict res_fascist_branch, residuals
*fasci_branch scatter
binscatter res_fascist_branch res_hpsu1919_vv, nquantiles(44) yti(Fascist local branches 1921, size(medium)) xti(Socialist vote share 1919, size(medium)) xlab(-0.02(0.02)0.04, nogrid labsize(medium)) ylab(-0.08(0.05)0.08, nogrid labsize(medium)) xscale(lcolor("black") fextend) yscale(lcolor("black") fextend ) plotregion(color(white))
graph export "${outpath}/fig4b.png", width(4000) replace
***
*fascist1924_vv residuals
qui reg fascist1924_vv `cntls_spec6'
predict res_fascist1924_vv, residuals
*fascist1924_vv scatter
binscatter res_fascist1924_vv res_hpsu1919_vv, nquantiles(44) yti(Fascist vote share 1924, size(medium)) xti(Socialist vote share 1919, size(medium)) xlab(-0.02(0.02)0.04, nogrid labsize(medium)) ylab(-0.05(0.05)0.06, nogrid labsize(medium)) xscale(lcolor("black") fextend) yscale(lcolor("black") fextend ) plotregion(color(white))
graph export "${outpath}/fig4d.png", width(4000) replace

***different sample for fascist1924_vv
drop hat_psu1919_vv res_hpsu1919_vv

*psu1919_vv predicted
qui reg psu1919_vv foots_pop6m `cntls_spec6' if fascist1921_vv!=.
predict hat_psu1919_vv if fascist1921_vv!=., xb
*psu1919_vv predicted residuals
qui reg hat_psu1919_vv `cntls_spec6' if fascist1921_vv!=.
predict res_hpsu1919_vv if fascist1921_vv!=., residuals
*fascist1921_vv residuals
qui reg fascist1921_vv `cntls_spec6'  if fascist1921_vv!=.
predict res_fascist1921_vv if fascist1921_vv!=., residuals
*fascist1921_vv scatter
binscatter res_fascist1921_vv res_hpsu1919_vv, nquantiles(41) yti(Fascist vote share in 1921, size(medium)) xti(Socialist vote share 1919, size(medium)) xlab(-0.02(0.02)0.04, nogrid labsize(medium)) ylab(-0.01(0.01)0.01, nogrid labsize(medium)) xscale(lcolor("black") fextend) yscale(lcolor("black") fextend ) plotregion(color(white))
graph export "${outpath}/fig4c.png", width(4000) replace
